<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>{$Think.session._systemname}</title>
    <meta content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no" name="viewport">
    <link rel="stylesheet" href="__PUBLIC__/adminlte/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="__PUBLIC__/adminlte/plugins/datatables/dataTables.bootstrap.css">
    <link rel="stylesheet" href="__PUBLIC__/adminlte/dist/css/AdminLTE.min.css">
    <link rel="stylesheet" href="__PUBLIC__/adminlte/dist/css/skins/_all-skins.min.css">

    <script src="__PUBLIC__/adminlte/plugins/jQuery/jQuery-2.1.4.min.js"></script>
    <script src="__PUBLIC__/adminlte/bootstrap/js/bootstrap.min.js"></script>
    <script src="__PUBLIC__/adminlte/plugins/datatables/jquery.dataTables.min.js"></script>
    <script src="__PUBLIC__/adminlte/plugins/datatables/dataTables.bootstrap.min.js"></script>
    <script src="__PUBLIC__/adminlte/plugins/slimScroll/jquery.slimscroll.min.js"></script>
    <script src="__PUBLIC__/adminlte/plugins/fastclick/fastclick.min.js"></script>
    <script src="__PUBLIC__/adminlte/dist/js/app.min.js"></script>

    <script src="__PUBLIC__/underscore-min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/zTree/css/zTreeStyle/metro.css"/>
    <script src="__PUBLIC__/zTree/js/jquery.ztree.all-3.5.min.js"></script>
    <script src="__PUBLIC__/bootstrap-typeahead.js"></script>
</head>
<style>
    th {
        vertical-align: middle;
        text-align: center;
    }

    td {
        vertical-align: middle;
        text-align: center;
    }
</style>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <header class="main-header">
        <a href="__PUBLIC__/adminlte/index2.html" class="logo">
            <span class="logo-lg">{$Think.session._systemname}</span>
        </a>
        <nav class="navbar navbar-static-top" role="navigation">
            <div class="navbar-custom-menu">
                <ul class="nav navbar-nav">
                    <li class="dropdown user user-menu">
                        <a href="__APP__/home/login">
                            <span class="hidden-xs" >注销</span>
                        </a>

                    </li>
                </ul>
            </div>
        </nav>
    </header>
    <aside class="main-sidebar">
        <section class="sidebar">
            <ul class="sidebar-menu">

                <assign name="menus" value="$Think.session.menus"/>

                <assign name="smid" value="$Think.session.mid"/>
                <assign name="scmid" value="$Think.session.cmid"/>

                <volist id="vo" name="menus">
                    <if condition="$vo.parentid eq 0">
                        <assign name="vid" value="$vo.id"/>

                        <if condition="$smid eq $vid">
                            <li class="treeview active">
                                <else/>
                            <li class="treeview">
                        </if>
                        <a href="#">
                            <i class="fa fa-dashboard"></i> {$vo.name}<span></span> <i
                                class="fa fa-angle-left pull-right"></i>
                        </a>
                        <ul class="treeview-menu menu-open">
                            <volist id="so" name="menus">
                                <assign name="cid" value="$so.parentid"/>
                                <assign name="coid" value="$so.id"/>
                                <if condition="$cid eq $vid">
                                    <if condition="$scmid eq $coid">
                                        <li class="active">
                                            <else/>
                                        <li>
                                    </if>
                                    <a
                                            onclick="loadAndSetMenuSession('{$so.parentid}',
                                                '{$so.id}','__APP__/{$so.url}')"
                                            href="javascript:void(0)"><i
                                            class="fa fa-circle-o"></i>
                                        {$so.name}</a></li>
                                </if>
                            </volist>

                            <!--<li class="active"><a href="__APP__/home/config"><i class="fa fa-circle-o"></i>-->
                            <!--系统参数设置</a>-->
                            <!--</li>-->
                            <!--<li class="active"><a href="__APP__/home/menu"><i class="fa fa-circle-o"></i> 菜单管理</a>-->
                            <!--</li>-->
                            <!--<li class="active"><a href="__APP__/home/role"><i class="fa fa-circle-o"></i> 角色管理</a>-->
                            <!--</li>-->
                            <!--<li class="active"><a href="__APP__/home/user"><i class="fa fa-circle-o"></i> 用户管理</a>-->
                            <!--</li>-->
                        </ul>
                        </li>
                    </if>
                </volist>
            </ul>
        </section>
        <!-- /.sidebar -->
    </aside>

    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        {__CONTENT__}
        <!-- Content Header (Page header) -->
    </div>
    <!-- /.content-wrapper -->
    <footer class="main-footer">
        <div class="pull-right hidden-xs">
            <b>Speed-CMDB</b> 0.0.1
        </div>
        <strong>Copyright &copy; 2014-2015 <a href="#">Speed Studio</a>.</strong> All rights reserved.
    </footer>

    <!-- /.control-sidebar -->
    <!-- Add the sidebar's background. This div must be placed
         immediately after the control sidebar -->
    <div class="control-sidebar-bg"></div>
</div>
<!-- ./wrapper -->

<!-- AdminLTE for demo purposes -->
<script>
    function loadAndSetMenuSession(fMenu, sMenu, url) {
        $.post('__APP__/home/common/setMenuSession',
                {'id': fMenu, 'subid': sMenu},
                function (rs) {
                    debugger
                    window.location.href = url;
                }
        );
    }

    function validate() {
        var obj = $("div[required]");
        var flag = true;
        for (var i = 0; i < obj.length; i++) {
            if (obj[i].children[1].children[0].value == "") {
                alert("请填写[" + obj[i].children[0].textContent + "]");
                flag = false;
                break;
            }
        }
        return flag;
    }
    function commonSubmit(formName, actionName, reload) {
        var data = $('#' + formName).serialize();
        if (validate()) {
            $.post(actionName, data, function (rs) {
                debugger;
                if (rs == "") {
                    if (reload == true) {
                        window.location.reload();
                    } else {
                        location.href = document.referrer;
                    }
                } else {
                    alert(rs);
                }
            }).error(function () {
                alert('操作异常，请联系管理员');
            });
        }
    }

    function deleteEntity(url, id) {
        //$('#loadingMsg').addClass('active');
        $.post(url, {"id": id}, function (rs) {
            //$('#loadingMsg').removeClass('active');
            if (rs == "") {
                window.location.reload();
            } else {
                alert(rs);
            }
        })
    }

    function checktb(obj, id) {
        if (obj.name == 'pmenu' && obj.checked == true) {
            $($("input[type='checkbox']")).each(function () {
                $(this).prop('checked', true);
            });
        }
        if (obj.name == 'pmenu' && obj.checked == false) {
            $($("input[type='checkbox']")).each(function () {
                $(this).removeAttr("checked");
            });
        }

        var uids = "";
        $($("input[type='checkbox']")).each(function () {
            if (this.checked == true && this.name != 'pmenu') {
                uids += this.id + ",";
            }
        });
        $("#" + id).val(uids);
    }
</script>
</body>
</html>
